// 基本组件接口
interface Component {
    void operation();
}

// 具体组件
class ConcreteComponent implements Component {
    @Override
    public void operation() {
        System.out.println("Concrete Component Operation");
    }
}

// 装饰者
class Decorator implements Component {
    private Component component;

    public Decorator(Component component) {
        this.component = component;
    }

    @Override
    public void operation() {
        component.operation();
        addedBehavior();
    }

    private void addedBehavior() {
        System.out.println("Decorator Added Operation");
    }
}

// 主类
public class DecoratorPatternDemo {
    public static void main(String[] args) {
        Component component = new ConcreteComponent();
        Component decoratedComponent = new Decorator(component);

        component.operation(); // 输出 Concrete Component Operation
        decoratedComponent.operation();
        // 输出 Concrete Component Operation
        // 输出 Decorator Added Operation
    }
}
